﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;
using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;

#nullable disable

namespace SystemWFH.Infrstructer.Migrations
{
    /// <inheritdoc />
    public partial class 生产计划01 : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "Equipments",
                columns: table => new
                {
                    equipmentId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    equipmentSerialNumber = table.Column<string>(type: "text", nullable: true),
                    equipmentName = table.Column<string>(type: "text", nullable: true),
                    equipmentNumbering = table.Column<string>(type: "text", nullable: true),
                    equipmentType = table.Column<int>(type: "integer", nullable: false),
                    equipmentState = table.Column<int>(type: "integer", nullable: false),
                    equipmentProductionLine = table.Column<string>(type: "text", nullable: true),
                    equipmentProcurementData = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    equipmentAddPeople = table.Column<string>(type: "text", nullable: true),
                    equipmentAddData = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
                    equipmentImage = table.Column<string>(type: "text", nullable: true),
                    IsDelete = table.Column<bool>(type: "boolean", nullable: false),
                    AddName = table.Column<string>(type: "text", nullable: true),
                    AddTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    UpdateName = table.Column<string>(type: "text", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    DelectName = table.Column<string>(type: "text", nullable: true),
                    DelectTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Equipments", x => x.equipmentId);
                });

            migrationBuilder.CreateTable(
                name: "Inspections",
                columns: table => new
                {
                    inspectionId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    inspectionSerialNumber = table.Column<string>(type: "text", nullable: true),
                    inspectionNo = table.Column<string>(type: "text", nullable: true),
                    inspectionItem = table.Column<string>(type: "text", nullable: true),
                    inspectionstandard = table.Column<string>(type: "text", nullable: true),
                    inspectionDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    inspectionState = table.Column<int>(type: "integer", nullable: false),
                    IsDelete = table.Column<bool>(type: "boolean", nullable: false),
                    AddName = table.Column<string>(type: "text", nullable: true),
                    AddTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    UpdateName = table.Column<string>(type: "text", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    DelectName = table.Column<string>(type: "text", nullable: true),
                    DelectTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Inspections", x => x.inspectionId);
                });

            migrationBuilder.CreateTable(
                name: "Maintenances",
                columns: table => new
                {
                    maintenanceId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    maintenanceNo = table.Column<string>(type: "text", nullable: true),
                    maintenanceNumber = table.Column<string>(type: "text", nullable: true),
                    maintenanceCycle = table.Column<string>(type: "text", nullable: true),
                    maintenanceType = table.Column<int>(type: "integer", nullable: false),
                    maintenanceSerialNumber = table.Column<int>(type: "integer", nullable: false),
                    maintenanceItem = table.Column<string>(type: "text", nullable: true),
                    maintenanceStandard = table.Column<string>(type: "text", nullable: true),
                    maintenanceState = table.Column<int>(type: "integer", nullable: false),
                    maintenanceDats = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    maintenanceImage = table.Column<string>(type: "text", nullable: true),
                    IsDelete = table.Column<bool>(type: "boolean", nullable: false),
                    AddName = table.Column<string>(type: "text", nullable: true),
                    AddTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    UpdateName = table.Column<string>(type: "text", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    DelectName = table.Column<string>(type: "text", nullable: true),
                    DelectTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Maintenances", x => x.maintenanceId);
                });

            migrationBuilder.CreateTable(
                name: "ProductionPlannings",
                columns: table => new
                {
                    productionId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    productionSerialNumber = table.Column<string>(type: "text", nullable: true),
                    theProductionPlanNumber = table.Column<string>(type: "text", nullable: true),
                    productionStatus = table.Column<int>(type: "integer", nullable: false),
                    theFinishedProduct = table.Column<string>(type: "text", nullable: true),
                    MyProperty = table.Column<int>(type: "integer", nullable: false),
                    specificationsAndModels = table.Column<string>(type: "text", nullable: true),
                    plannedProduction = table.Column<string>(type: "text", nullable: true),
                    numberReportedJobs = table.Column<int>(type: "integer", nullable: false),
                    orderNumber = table.Column<int>(type: "integer", nullable: false),
                    DeliveryDate = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
                    routing = table.Column<int>(type: "integer", nullable: false),
                    workShop = table.Column<int>(type: "integer", nullable: false),
                    planTheStartTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
                    scheduledEndTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
                    actualStartTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
                    actualEndTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: false),
                    IsDelete = table.Column<bool>(type: "boolean", nullable: false),
                    AddName = table.Column<string>(type: "text", nullable: true),
                    AddTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    UpdateName = table.Column<string>(type: "text", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    DelectName = table.Column<string>(type: "text", nullable: true),
                    DelectTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_ProductionPlannings", x => x.productionId);
                });

            migrationBuilder.CreateTable(
                name: "Relevancys",
                columns: table => new
                {
                    relevancyId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    workshopId = table.Column<int>(type: "integer", nullable: false),
                    equipmentId = table.Column<int>(type: "integer", nullable: false),
                    maintenanceId = table.Column<int>(type: "integer", nullable: false),
                    repairprogresId = table.Column<int>(type: "integer", nullable: false),
                    inspectionId = table.Column<int>(type: "integer", nullable: false),
                    AddName = table.Column<string>(type: "text", nullable: true),
                    AddTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    UpdateName = table.Column<string>(type: "text", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    DelectName = table.Column<string>(type: "text", nullable: true),
                    DelectTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Relevancys", x => x.relevancyId);
                });

            migrationBuilder.CreateTable(
                name: "RepairProgres",
                columns: table => new
                {
                    repairprogresId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    repairprogresNo = table.Column<string>(type: "text", nullable: true),
                    repairprogresName = table.Column<string>(type: "text", nullable: true),
                    repairprogresDescription = table.Column<string>(type: "text", nullable: true),
                    repairprogresState = table.Column<int>(type: "integer", nullable: false),
                    repairprogresDateFailure = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    repairprogresRepairTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    IsDelete = table.Column<bool>(type: "boolean", nullable: false),
                    AddName = table.Column<string>(type: "text", nullable: true),
                    AddTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    UpdateName = table.Column<string>(type: "text", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    DelectName = table.Column<string>(type: "text", nullable: true),
                    DelectTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_RepairProgres", x => x.repairprogresId);
                });

            migrationBuilder.CreateTable(
                name: "Workshops",
                columns: table => new
                {
                    workshopId = table.Column<int>(type: "integer", nullable: false)
                        .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn),
                    workshopNo = table.Column<string>(type: "text", nullable: true),
                    workshopName = table.Column<string>(type: "text", nullable: true),
                    workshopLocation = table.Column<string>(type: "text", nullable: true),
                    workshopLeader = table.Column<string>(type: "text", nullable: true),
                    workshopContact = table.Column<string>(type: "text", nullable: true),
                    workshopState = table.Column<int>(type: "integer", nullable: false),
                    IsDelete = table.Column<bool>(type: "boolean", nullable: false),
                    AddName = table.Column<string>(type: "text", nullable: true),
                    AddTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    UpdateName = table.Column<string>(type: "text", nullable: true),
                    UpdateTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true),
                    DelectName = table.Column<string>(type: "text", nullable: true),
                    DelectTime = table.Column<DateTime>(type: "timestamp with time zone", nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_Workshops", x => x.workshopId);
                });
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "Equipments");

            migrationBuilder.DropTable(
                name: "Inspections");

            migrationBuilder.DropTable(
                name: "Maintenances");

            migrationBuilder.DropTable(
                name: "ProductionPlannings");

            migrationBuilder.DropTable(
                name: "Relevancys");

            migrationBuilder.DropTable(
                name: "RepairProgres");

            migrationBuilder.DropTable(
                name: "Workshops");
        }
    }
}
